#ifndef CGRadioH
#define CGRadioH

#include <SysUtils.hpp>
#include <Controls.hpp>
#include <Classes.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include <StdCtrls.hpp>
#include <dsgnintf.hpp>
#include "CtrlStd.h"
#include "EditGRad.h"
#include "CRadBtn.h"

#define LEFT_CAPTION           8
#define COL_EDIT_GRADIO clInfoBk

class CItems : public TPropertyEditor
    {
    private:
        typedef TPropertyEditor inherited;
        _di_IFormDesigner eDesigner;

    public:
        __fastcall CItems(void);
        TPropertyAttributes __fastcall GetAttributes( void );
        virtual void __fastcall Edit( void );
        virtual AnsiString __fastcall GetValue() {return("(Liste)");};
    };



class PACKAGE_CTRLSTD CGRadio : public TCustomRadioGroup
    {
    private:
        int         FColumns;
        TFont       *FFontRadBut;
        signed int  FItemIndex;
        TStringList *FListRad;
        TPicture    *FPicture;
        bool        FReadOnly;
        bool        FTransparent;
        AnsiString  FReference;

    __published:
        __property              Align;
        __property AnsiString   Caption             = { read=GetCaption,    write=SetCaption,       default = false     };
        __property bool         CaptionTransparent  = { read=FTransparent,  write=SetTransparent,   default = true      };
        __property TColor       Color               = { read=GetColor,      write=SetColor,         default = clBtnFace };
        __property int          Columns             = { read=FColumns,      write=SetColumns,       default = 1         };
        __property              DragCursor;
		__property              DragMode;
        __property bool         Enabled             = { read=GetEnabled,    write=SetEnabled,       default = true      };
        __property              Font;
        __property TFont        *FontRadioButtons   = { read=FFontRadBut,   write=SetFontRadBut                         };
        __property              HelpContext;
        __property              Hint;
        __property signed int   ItemIndex           = { read=FItemIndex,    write=SetItemIndex,     default = -1        };
		__property TStringList  *Items              = { read=FListRad,      write=FListRad,         default = NULL      };
        __property              ParentFont;
        __property              ParentShowHint;
        __property TPicture     *Picture            = { read=GetPicture,    write=SetPicture,       default = NULL      };
        __property              PopupMenu;
        __property bool         ReadOnly            = { read=FReadOnly,     write=SetReadOnly,      default = false     };              
        __property              ShowHint;
        __property              TabOrder;
        __property              TabStop;
        __property              Visible;
        __property AnsiString   Reference = { read=FReference, write=FReference };

        // Evenements
        __property OnStartDrag;
        __property OnDragDrop;
        __property OnDragOver;
        __property OnEndDrag;
        __property OnKeyDown;
        __property OnKeyPress;
        __property OnKeyUp;
        __property OnEnter;
        __property OnExit;
        __property OnMouseDown;
        __property OnMouseMove;
        __property OnMouseUp;
        __property OnClick;
        __property OnDblClick;

        AnsiString __fastcall GetReference( void);

    private:
        typedef TCustomRadioGroup inherited;
        TLabel *LCaption;
		TImage *IBkGrnd;
		bool	bInit;

    protected:
        virtual void __fastcall WndProc(    TMessage &Message );
        void __fastcall FontRadButOnChange( TObject *Sender );
        void __fastcall ListRadOnChanging(  TObject *Sender );
        void __fastcall ListRadOnChange(    TObject *Sender  );

    private:
        void        __fastcall SetCaption( const AnsiString aCaption        );
        void        __fastcall SetColor(        TColor      CColor          );
        void        __fastcall SetColumns(      int         iColumns        );
        void        __fastcall SetEnabled(      bool        bEnabled        );
        void        __fastcall SetFontRadBut(   TFont       *FFont          );
        void        __fastcall SetItemIndex(    signed int  iItemIndex      );
        void        __fastcall SetPicture(      TPicture    *PPicture       );
        void        __fastcall SetReadOnly(     bool        bReadOnly       );
        void        __fastcall SetTransparent(  bool        bTransparent    );
        bool        __fastcall GetEnabled();
        AnsiString  __fastcall GetCaption() /*const*/;
        TPicture *  __fastcall GetPicture() const;
        TColor      __fastcall GetColor() const;

        void        __fastcall InitIBkGrnd();
        void        __fastcall InitCaption();
        void        __fastcall PaintTexture();
        void        __fastcall PaintBord();
        void        __fastcall DrawRect( TRect R, TColor CColor );
        void        __fastcall ArrangeRadBut();

        void __fastcall SetItems( TMemo *List );
        TMemo * __fastcall GetItems();

    public:
        __fastcall CGRadio(TComponent* Owner);
        virtual __fastcall ~CGRadio( void);

    };
#endif // #ifndef CGRadioH
